home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-30 | 1.4 KB | 56 lines | [TEXT/GEOL] |
- Item 6495376 26-March-90 10:39PST
-
- From: KEMINK1 Kemink, Joost
-
- To: CHANDLER1 Chandler, Dick
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: Re-Getting Control?
-
- Dick,
-
- You could create an event handler for each serial buffer. Such a handler's
- DoIdle method could then check for data in the buffer and take appropriate
- action. Something like this:
-
- TBufferWatcher = OBJECT (TEvtHandler)
- PROCEDURE TBufferWatcher.Free; OVERRIDE;
- PROCEDURE TBufferWatcher.IBufferWatcher;
- FUNCTION TBufferWatcher.DoIdle(phase:IdlePhase):BOOLEAN; OVERRIDE;
- END;
-
- FUNCTION TBufferWatcher.DoIdle(phase:IdlePhase):BOOLEAN; OVERRIDE;
- BEGIN
- { • Check for bytes in the serial buffer and take action if there are }
-
- DoIdle:=FALSE;
- END;
-
- PROCEDURE TBufferWatcher.IBufferWatcher;
- BEGIN
- SELF.IEvtHandler(NIL);
-
- { • Check at most every second }
- SELF.SetIdleFreq(60);
-
- { • Attach the buffer to be watched to SELF, for example by assigning it to
- one of SELF's fields }
-
- { • Instal the event handler in the cohandler chain }
- gApplication.InstallCohandler(SELF,TRUE);
- END;
-
- PROCEDURE TBufferWatcher.Free; OVERRIDE;
- BEGIN
- { • Remove the event handler from the cohandler chain }
- gApplication.InstallCohandler(SELF,FALSE);
-
- INHERITED Free;
- END;
-
- Hope this helps,
-
- Joost Kemink
-
-